<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
        <title>Dynatree - Example</title>
        <script src="../jquery/jquery.js" type="text/javascript"></script>
        <script src="../jquery/jquery-ui.custom.js" type="text/javascript"></script>
        <script src="../jquery/jquery.cookie.js" type="text/javascript"></script>
        <link href="../src/skin-vista/ui.dynatree.css" rel="stylesheet" type="text/css">
        <script src="../src/jquery.dynatree.js" type="text/javascript"></script>
        <link href="../src/skin/ui.dynatree.css" rel="stylesheet" type="text/css">
        <script src="../src/jquery.dynatree.js" type="text/javascript"></script>
        <link href="tree.css" rel="stylesheet" type="text/css">
        <!-- End_Exclude -->
        <script type="text/javascript">
            $(function(){
                // --- Initialize sample trees
                $("#tree").dynatree({
                    checkbox: true,
                    selectMode: 3,
                    activeVisible: true,
                    title: "File commiter",
                    fx: { height: "toggle", duration: 200 },
                    autoFocus: false, // Set focus to first child, when expanding or lazy-loading.
                    initAjax: {
                        url: "../../folder.php"
                    },
                    onLazyRead: function(node){
                        node.appendAjax({
                            url: "../../folder.php",
                            data: {"path": getNodePath(node)},
                            debugLazyDelay: 350
                        });
                    }
                });
                <!-- Start_Exclude: This block is not part of the sample code -->
                $("#skinCombo")
                .val(0) // set state to prevent caching
                .change(function(){
                    var href = "../src/"
                        + $(this).val()
                        + "/ui.dynatree.css"
                        + "?reload=" + new Date().getTime();
                    $("#skinSheet").attr("href", href);
                });
                <!-- End_Exclude -->
                $("form").submit(function() {
                    if(!$.trim($("#commentaire").val())){
                        alert("commentaire vide !");
                        return false;
                    }
                    var postData = {};
                    formData = $("#tree").dynatree("getTree").getSelectedNodes();
                    for(var val in formData)
                        postData[val]=getNodePath(formData[val]);
			
                    postData["com"] = $.trim($("#commentaire").val());
                    if($('#deploy').attr('checked')!='undefined')
                        postData["dep"] = $('#deploy').attr('checked');

                    $.post("../../commit.php",
                    postData,
                    function(response, textStatus, xhr){
                        alert("POST returned " + response + ", " + textStatus);
                    });
                    return false;
                });
            });

            function getNodePath(node){
                var parentNode = node.getParent();
                var res='';
                while( parentNode.data.title != null ){
                    res ='/'+parentNode.data.title+'/'+res;
                    parentNode = parentNode.getParent();
                }
                res+=node.data.title;
                return res;
            }
        </script>
    </head>

    <body class="example">
        <div class="page-header">
            <h1>PPD File Uploader</h1>
        </div>
        <blockquote>
            <p>Cet outil permet d'envoyer les fichiers sur svn et en meme temps publier sur le site<br/>
                Pour cela il faut selectionner les fichiers et remplir le formulaire avant d'envoyer.</p>
        </blockquote>

        <form methode="POST" action="../../commit.php">
            <div id="tree"><!-- When using initAjax, it may be nice to put a throbber here, that spins until the initial content is loaded: -->
            </div>
            <p>Commentaire du commit</br>
                <textarea rows="2" cols="20" id="commentaire" name="commentaire"></textarea></p>
            <p><input type="checkbox" id="deploy" name="deploy" >Publier sur le site</p>
            <input class="fileinput-button" type="submit" value="Envoyer"><br/>
        </form>
        <div class="well">
            <h3>Limites</h3>
            <ul>
                <li>La taille maximum par upload est limit&eacute;e a <strong>5 MB</strong></li>
                <li>Les extensions des images permises sont (<strong>JPG, GIF, PNG</strong>)</li>
            </ul>	
        </div>
    </body>

</html>
